<?php

namespace api\activity\controller;

class AdminIndexController extends \Aaa\activity\controller\AdminIndexController {

    protected $baseField = [
        [
            'field' => 'id',
            'name' => 'ID',
        ],
        [
            'field' => 'title',
            'name' => '标题',
        ],
        [
            'field' => 'subtitle',
            'name' => '副标题',
        ],
        [
            'field' => 'description',
            'name' => '描述',
        ],
        [
            'field' => 'image',
            'name' => '主图',
            'type' => 'image',
        ],
        [
            'field' => 'article_id',
            'name' => '绑定文章',
            'type' => 'select',
            'options' => [
                ['name' => '无', 'value' => 0],
            ],
            'optionsSource' => [
                'table' => 'article',
                'nameField' => 'title',
                'valueField' => 'id',
            ],
        ],
        [
            'field' => 'create_time',
            'name' => '创建时间',
            'type' => 'time',
        ],
        [
            'field' => 'update_time',
            'name' => '更新时间',
            'type' => 'time',
        ],
        [
            'field' => 'list_order',
            'name' => '排序',
        ],
    ];

    protected function beforeIndex() {
        $this->searchField = [
            'common' => [
                'id' => 'accurate',
                'title' => 'fuzzy',
                'subtitle' => 'fuzzy',
                'description' => 'fuzzy',
            ],
            'time' => ['create_time', 'update_time'],
        ];
    }

    protected function beforeAdd() {
        $this->actionField = ['title', 'subtitle', 'description', 'image', 'article_id', 'list_order',];
    }

    protected function beforeEdit() {
        $this->beforeAdd();
    }


}
